package com.headfirst.BehaviorMode.iterator.version1;

import java.util.ArrayList;

public class Waitress {

    PancakeHouseMenu pancakeHouseMenu;
    DinerMenu dinerMenu;

    public Waitress(PancakeHouseMenu pancakeHouseMenu, DinerMenu dinerMenu) {
        this.pancakeHouseMenu = pancakeHouseMenu;
        this.dinerMenu = dinerMenu;
    }

    //打印出菜单上的每一项
    public void printMenu() {
        System.out.println("---早餐菜单---");
        ArrayList<MenuItem> breakfastItems = pancakeHouseMenu.getMenuItems();
        for (int i = 0; i < breakfastItems.size(); i++) {
            MenuItem menuItem = breakfastItems.get(i);
            System.out.println(menuItem.getName() + " ");
            System.out.println(menuItem.getPrice() + " ");
            System.out.println(menuItem.getDescription() + " ");
            System.out.println();
        }
        System.out.println("---午餐菜单---");
        MenuItem[] lunchItems = dinerMenu.getMenuItems();
        for (int i = 0; i < lunchItems.length; i++) {
            MenuItem menuItem = lunchItems[i];
            System.out.println(menuItem.getName() + " ");
            System.out.println(menuItem.getPrice() + " ");
            System.out.println(menuItem.getDescription() + " ");
            System.out.println();
        }
    }

    // 打印所有早餐菜单项
    public void printBreakfastMenu() {
        System.out.println("---早餐菜单---");
        ArrayList<MenuItem> breakfastItems = pancakeHouseMenu.getMenuItems();
        for (int i = 0; i < breakfastItems.size(); i++) {
            MenuItem menuItem = breakfastItems.get(i);
            System.out.println(menuItem.getName() + " ");
            System.out.println(menuItem.getPrice() + " ");
            System.out.println(menuItem.getDescription() + " ");
            System.out.println();
        }
    }

    // 打印所有午餐菜单项
    public void printLunchMenu() {
        System.out.println("---午餐菜单---");
        MenuItem[] lunchItems = dinerMenu.getMenuItems();
        for (int i = 0; i < lunchItems.length; i++) {
            MenuItem menuItem = lunchItems[i];
            System.out.println(menuItem.getName() + " ");
            System.out.println(menuItem.getPrice() + " ");
            System.out.println(menuItem.getDescription() + " ");
            System.out.println();
        }
    }
    
    // 打印所有的素食菜单项
    public void printVegetarianMenu(){
        ArrayList<MenuItem> breakfastItems = pancakeHouseMenu.getMenuItems();
        for(int i=0;i<breakfastItems.size();i++){
            MenuItem menuItem = breakfastItems.get(i);
            if(menuItem.isVegetarian()){
                System.out.println(menuItem.getName() + " ");
                System.out.println(menuItem.getPrice() + " ");
                System.out.println(menuItem.getDescription() + " ");
                System.out.println();
            }
        }
    }
    
    // 是否是素食
    public boolean isItemVegetarian(String name){
        return false;
    }
}
